<include target="_header.html" />
<div id="search">
	<form action="./" method="get" id="fo_search" class="search_box" no-error-return-url="true">
	<input cond="$vid" type="hidden" name="vid" value="{$vid}" />
	<input type="hidden" name="mid" value="{$mid}" />
	<input type="hidden" name="category" value="{htmlspecialchars($category)}" />
	<input id="searchkey" type="text"  name="search_keyword" value="{$search_keyword}" class="inputText" accesskey="S" title="{$lang->cmd_search}">
		<button type="submit" class="btn_search">{$lang->cmd_search}</button>
	</form>
</div>
<div cond="$XE_VALIDATOR_MESSAGE && $XE_VALIDATOR_ID == 'modules/guestbook/skins/xe_guestbook_official/guestbook/1'" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
	<p>{$XE_VALIDATOR_MESSAGE}</p>
</div>
<div class="replyForm" cond="$grant->write && !$modify && !$reply">
	<form method="post" action="./" ruleset="insertGuestbookitem" id="fo_guestbookitem_insert">
		<input type="hidden" name="act" value="procGuestbookInsertGuestbookItem" />
		<input name="mid" type="hidden" value="{$mid}" />
		<input type="hidden" name="xe_validator_id" value="modules/guestbook/skins/xe_guestbook_official/guestbook/1" />
		
		<div class='guestbook_form'>
			<label for="edit-message">Message: <span title="This field is required." class="form-required">*</span></label>
			<fieldset>
				<textarea class="inputTextarea" name="content" rows="5" cols="50"></textarea>
		    </fieldset>
			<!--@if($is_logged)-->
				<input name="member_srl" type="hidden" value="{$logged_info->member_srl}" />
				<span class="member_{$logged_info->member_srl} gb_name"><strong class="name">{$logged_info->nick_name}</strong></span> <span class="email">{$logged_info->email_address}</span> <span class="url">{$logged_info->homepage}</span>
				<div class="input_submit">
					<input name="submit" type="submit" value="Submit" class="inputSubmit" />
				</div>
			<!--@else-->
				<input name="user_name" type="text" class="inputText name" value="Username" title="Username"/>
				<input name="email_address" type="text" class="inputText name" value="Email" title="Email"/>
				<input name="password" type="password" class="inputText pw" value="Password" title="Password" />

				<div class="input_submit2">
					<input name="submit" type="submit" value="submit" class="inputSubmit2" />
				</div>
			<!--@end-->
		</div>
	</form>
</div>

<div class="feedback reply">
	<ol cond="$guestbook_list" class="feedbackOrder">
		<block loop="$guestbook_list => $key, $val">
			<li id="guestbook_{$val->guestbook_item_srl}" cond="$modify == $val->guestbook_item_srl" class="item replyForm">
				<div cond="$XE_VALIDATOR_MESSAGE && $XE_VALIDATOR_ID == 'modules/guestbook/skins/xe_guestbook_official/guestbook/2'" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
					<p>{$XE_VALIDATOR_MESSAGE}</p>
				</div>
				<form method="post" ruleset="insertGuestbookitem" action="./" id="fo_guestbookitem_modify">
					<input type="hidden" name="act" value="procGuestbookInsertGuestbookItem" />
					<input name="mid" type="hidden" value="{$mid}" />
					<input type="hidden" name="guestbook_item_srl" value="{$val->guestbook_item_srl}" />
					<input type="hidden" name="xe_validator_id" value="modules/guestbook/skins/xe_guestbook_official/guestbook/2" />
					<input type="hidden" name="error_return_url" value="{getRequestUriByServerEnviroment()}#guestbook_{$val->guestbook_item_srl}" />
					<fieldset>
						<textarea class="inputTextarea" name="content" rows="5" cols="50">{@ $guestbook_content = strip_tags($val->content)}{$guestbook_content}</textarea>
					</fieldset>
					<block cond="$is_logged">
						<input name="member_srl" type="hidden" value="{$logged_info->member_srl}" />
						<span class="member_{$logged_info->member_srl}"><strong class="name">{$logged_info->nick_name}</strong></span> <span class="email">{$logged_info->email_address}</span> <span class="url">{$logged_info->homepage}</span>
						<div class="input_submit2">
							<input name="submit" type="submit" value="Modify" class="inputSubmit2" />
						</div>
					</block>
					<block cond="!($is_logged)">
						<input name="user_name" type="text" class="inputText name" value="{$val->user_name ? $val->user_name : 'Username'}" title="Username"/>
						<input name="email_address" type="text" class="inputText name" value="{$val->user_name ? $val->email_address : 'Email'}" title="Email"/>
						<input name="password" type="password" class="inputText pw" value="Password" title="Password" />
						<div class="input_submit2">
							<input name="submit" type="submit" value="Modify" class="inputSubmit2" />
							<input name="submit" type="button" value="Cancel" class="inputSubmit2" onclick="document.location.href=current_url.setQuery('modify', '')" />
						</div>
					</block>
				</form>							
			</li>
			<li cond="$modify != $val->guestbook_item_srl" class="item"|cond="$val->parent_srl <= 0" class="item indent indent1"|cond="$val->parent_srl>0">
				{@ 
					$oMemberModel = &getModel('member');
					$memberConfig = $oMemberModel->getMemberConfig();
				}
				<div class="item2">
					<div class="img" cond="$memberConfig->profile_image == 'Y'">
						{@ $memberImage = $oMemberModel->getProfileImage($val->member_srl);}
						<img cond="$memberImage" border="0" src="{$memberImage->src}" width="69" height="68">
						<img cond="!($memberImage)" border="0" src="./img/default_member.gif" width="69" height="68">
					</div>
					<div class="meta">
						<h4 class="author">
							<a cond="$val->homepage" href="{$val->homepage}" onclick="window.open(this.href);return false;" class="member_{$val->member_srl}">{$val->nick_name}</a>
							<a href="#popup_menu_area" cond="!$val->homepage" class="member_{$val->member_srl}">
								<block cond="$val->nick_name">{$val->nick_name}</block>
								<block cond="!$val->nick_name">{$val->email_address}</block>
							</a>
						</h4>
						<span class="ip" cond="$grant->manager">({$val->ipaddress})</span>
						<span class="date">{zdate($val->regdate,'Y.m.d')} <span class="hhmm">{zdate($val->regdate,'H:i')}</span></span>
						<ul class="reAction" id="{$val->guestbook_item_srl}_re">
							<li>
								<a href="{getUrl('modify','','reply',$val->guestbook_item_srl)}#guestbook_{$val->guestbook_item_srl}" cond="$val->parent_srl==0 && $grant->write_reply">{$lang->cmd_reply}</a>
								<a href="{getUrl('reply','','modify',$val->guestbook_item_srl)}#guestbook_{$val->guestbook_item_srl}" cond="$val->member_srl == 0 || $grant->manager || ($val->member_srl && $logged_info->member_srl == $val->member_srl)">{$lang->cmd_modify}</a>
								<block cond="$grant->manager || $logged_info->member_srl == $val->member_srl || $val->member_srl === '0'">
								<!--@if($val->member_srl !== '0' || $grant->manager)-->
								<a onclick="if(confirm('{$lang->confirm_delete}')) deleteGuestbookItem({$val->guestbook_item_srl});">{$lang->cmd_delete}</a>
								<!--@else-->
								<span>
									<span style="display:none" class="input_password">
										* 암호를 입력하세요 : <input name="password" type="password" class="inputText name" />
										<a onclick="if(confirm('{$lang->confirm_delete}')) deleteGuestbookItem({$val->guestbook_item_srl},jQuery(this).prev().val());">{$lang->cmd_delete}</a>
									</span>
									<a onclick="jQuery(this).css('display','none').prev().css('display','');">{$lang->cmd_delete}</a>
								</span>
								<!--@end-->
								</block>
							</li>
						</ul>
						<script>
							jQuery(function($){
								var ul_id = '#{$val->guestbook_item_srl}_re';
								$(ul_id).find('li').last().attr('class', 'last');
							});
						</script>
					</div>
					<div class="data">
						{$val->content}
					</div>
				</div>
			</li>
			<li id="guestbook_{$val->guestbook_item_srl}" cond="$reply == $val->guestbook_item_srl && $grant->write_reply" class="item replyForm">
				<div cond="$XE_VALIDATOR_MESSAGE && $XE_VALIDATOR_ID == 'modules/guestbook/skins/xe_guestbook_official/guestbook/3'" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
					<p>{$XE_VALIDATOR_MESSAGE}</p>
				</div>
				<form method="post" ruleset="insertGuestbookitem"  action="./"  id="fo_guestbookitem_reply">
					<input type="hidden" name="act" value="procGuestbookInsertGuestbookItem" />
					<input name="mid" type="hidden" value="{$mid}" />
					<input type="hidden" name="parent_srl" value="{$val->guestbook_item_srl}" />
					<input type="hidden" name="xe_validator_id" value="modules/guestbook/skins/xe_guestbook_official/guestbook/3" />
					<input type="hidden" name="error_return_url" value="{getRequestUriByServerEnviroment()}#guestbook_{$val->guestbook_item_srl}" />
					<fieldset>
						<textarea class="inputTextarea" name="content" rows="5" cols="50"></textarea>
					</fieldset>
					<block cond="$is_logged">
						<input name="member_srl" type="hidden" value="{$logged_info->member_srl}" />
						<span class="member_{$logged_info->member_srl} gb_name"><strong class="name">{$logged_info->nick_name}</strong></span> <span class="email">{$logged_info->email_address}</span> <span class="url">{$logged_info->homepage}</span>
						<div class="input_submit">
							<input name="submit" type="submit" value="Reply" class="inputSubmit" />
						</div>
					</block>
					<block cond="!($is_logged)">
						<input name="user_name" type="text" class="inputText name" value="Username" title="Username"/>
						<input name="email_address" type="text" class="inputText name" value="Email" title="Email"/>
						<input name="password" type="password" class="inputText pw" value="Password" title="Password" />
						<div class="input_submit2">
							<input name="submit" type="submit" value="Reply" class="inputSubmit2" />
							<input name="submit" type="button" value="Cancel" class="inputSubmit2" onclick="document.location.href=current_url.setQuery('reply', '')" />
						</div>
					</block>
				</form>
			</li>
		</block>
	</ol>
</div>

<div cond="$page_navigation" class="pagination">
	<a href="{getUrl('page','','guestbook_item_srl','','division',$division,'last_division',$last_division)}" class="prevEnd">{$lang->first_page}</a> 
	 
	<block loop="$page_no = $page_navigation->getNextPage()">
		<strong cond="$page == $page_no">{$page_no}</strong> 
		<a cond="$page != $page_no" href="{getUrl('page',$page_no,'question_srl','','division',$division,'last_division',$last_division)}">{$page_no}</a>
	</block>
	
	<a href="{getUrl('page',$page_navigation->last_page,'question_srl','','division',$division,'last_division',$last_division)}" class="nextEnd">{$lang->last_page}</a>
</div>

<script>
jQuery(function(){
		jQuery('input:text,input:password')
		.focus(function(e){
			var jthis = jQuery(this);
			if(jthis.attr('title') && jthis.val()== jthis.attr('title')) jthis.val('');
			}).blur(function(e){
				var jthis = jQuery(this);
				if(jthis.attr('title') && !jthis.val()) jthis.val(jthis.attr('title'));	
				});
		});
</script>
<include target="_footer.html" />

